//
//  SheQuPeiHuViewController.m
//  XiangMu
//
//  Created by  kangshibiao on 15/7/14.
//  Copyright (c) 2015年 kangshibiao. All rights reserved.
//

#import "SheQuPeiHuViewController.h"

@interface SheQuPeiHuViewController ()

@end

@implementation SheQuPeiHuViewController

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:YES];
    
    self.tabBarController.tabBar.hidden = YES;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
  

     self.title=@"社区陪护";
   


    [self QingQiuImags];
    [self initBarButton];

    
    
}
//返回按钮
- (void)initBarButton{
  
    
    UIButton*fanHuiBtn=[UIButton buttonWithType:UIButtonTypeCustom];
    fanHuiBtn.frame=CGRectMake(20, 20, 10, 20);
    
    [fanHuiBtn addTarget:self action:@selector(FanHui) forControlEvents:UIControlEventTouchUpInside];
    [fanHuiBtn setBackgroundImage:[UIImage imageNamed:@"fanhui"] forState:UIControlStateNormal];
    UIBarButtonItem*barFanHui=[[UIBarButtonItem alloc]initWithCustomView:fanHuiBtn];
    self.navigationItem.leftBarButtonItem=barFanHui;

//    [[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(NSIntegerMin, NSIntegerMin) forBarMetrics:UIBarMetricsDefault];

    
}
//轮播图
- (void)pageView{
    
    PageView * page =[[PageView alloc]initPageViewFrame:CGRectMake(0, 0, kScreenW, kScreenH/3-10)];
    
    page.isWebImage = YES;
    page.imageArray =_imagesArr;
    page.duration = 2.0;
    
    [self.view addSubview:page];
    
}
//老人陪护
- (IBAction)TheOldManaCare:(UIButton *)sender
{
    YiYuanPeiHuViewController * yi = [[YiYuanPeiHuViewController alloc]init];
    yi.isLaoRen = YES;
    yi.tittexte = @"陪护信息";
    [self.navigationController pushViewController:yi animated:YES];
    
}
//护工列表 家庭保姆 小时工
- (IBAction)care:(UIButton *)sender {
   
    PeiHuShiViewController * p =[[PeiHuShiViewController alloc]init];
    
    p.tabBarHidden = YES;
    
    [self.navigationController pushViewController:p animated:YES];
    
}
//网络请求数据
- (void)QingQiuImags{
    
    [QingQiuShuJu ShouYeImagView:@"2" HuiChuan:^(NSMutableArray *arr, BOOL isOK) {
        
        if (isOK) {
            
            _imagesArr= arr;
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            [self pageView];
            
        }
        else{
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            
            MBProgressHUD *hud =[MBProgressHUD showHUDAddedTo:self.view animated:YES];
            
            hud.mode = MBProgressHUDModeText;
            
            hud.labelText = @"网络连接错误";
            
            hud.removeFromSuperViewOnHide = YES;
            
            [hud hide:YES afterDelay:1.5];
            
            
            
        }
    }];
}
//tabr返回
- (void)FanHui {
    self.tabBarController.tabBar.hidden=NO;
    
    [self.navigationController popViewControllerAnimated:YES];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
